
import React from "react";
function AlertWindow({ title, sureOrCancel, target,type,action}) {
    return (
        <>
            <div style={{
                position: 'fixed',
                top: 0,
                left: 0,
                width: 100 + 'vw',
                height: 100 + 'vw',
                backgroundColor: 'rgb(0,0,0,0.5)',
                zIndex: 1
            }}>
                <div style={{
                    backgroundColor: '#fff',
                    borderRadius: '1vw',
                    margin: '40vh 40vw',
                    width: 30 + 'vw',
                    height: 30 + 'vh',
                    userSelect: 'none',
                    

                }}>
                    <h2 style={{
                        width:'100%',
                        paddingTop:'2vh',
                        fontSize:'3vh',
                        textAlign:"center"}}><strong>{title}</strong></h2>
                    <div style={{
                        marginTop:'14vh',
                        width:'30vw',
                        paddingLeft:'13vw'
                    }}>
                        <button
                            style={{
                                fontSize:'1.5vh',
                                width: '6.5vw',
                                height: '3.5vh',
                                lineHeight: '3.5vh',
                                borderRadius: '1vw',
                                backgroundColor: type=='alert'?'red':"green",
                                marginRight:'2vw',
                                border: '0px',
                                cursor:"pointer"
                            }}
                            onClick={() => {
                                sureOrCancel(target,action)
                            }} > 确认
                            </button>

                        {type == 'alert'?<button style={{
                            fontSize:'1.5vh',
                            width: '6.5vw',
                            height: '3.5vh',
                            lineHeight: '3.5vh',
                            borderRadius: '1vw',
                            backgroundColor: 'green',
                            border: '0px',
                            cursor:"pointer"
                        }}
                            onClick={() => {sureOrCancel(target=null,action=null)}}> 取消</button>:null }
                    </div>

                </div>
            </div>
        </>
    )
}
export default AlertWindow